/**
 * Created by Administrator on 2018/1/19.
 */
var loadings = document.getElementsByClassName("loading");

for(var i=0;i<loadings.length;i++){
    showLoading(loadings[i]);
}

function showLoading(load){
    var count = 0;
    var oldValue = load.innerHTML;
    load.timer = setInterval(function(){
        if(count==3){
            load.innerHTML = oldValue;
            count = 0;
        }
        load.innerHTML += ".";
        count++;
    },load.getAttribute("time")||300);
}

HTMLElement.prototype.stopLoading = function(txt){
  if(this.className=="loading"){
    clearInterval(this.timer);
    this.innerHTML = txt;
  }
};











